package com.spsy.asyncqueue;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

@Service
public class Createqueue {

    @Autowired
    StringRedisTemplate stringRedisTemplate;

    @Async("xianchengzu1")
    public void sendNotification(Object o){
        stringRedisTemplate.opsForValue().set((String) o, (String) o,20, TimeUnit.MINUTES);
        System.out.println("异步线程执行完毕");
    }

    @Async("xianchengzu1")
    public void testExecotion(){

        Integer s = 1/0;
    }
}
